{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ddd565e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "file = open(\"name.json\", 'r', encoding='utf-8')\n",
    "detailFile = open(\"data.json\", 'r', encoding='utf-8')\n",
    "names = []\n",
    "detailDatas=[]\n",
    "detailDatasReverse=detailDatas[::-1]\n",
    "for line in file.readlines():\n",
    "    dic = json.loads(line)\n",
    "    names.append(dic)\n",
    "\n",
    "for line in detailFile.readlines():\n",
    "    dic = json.loads(line)\n",
    "    detailDatas.append(dic)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "ff16ba7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(0,len(names)):  \n",
    "    temps=[]\n",
    "    url='cloud://xibaolab-6mm5s.7869-xibaolab-6mm5s-1259720017'\n",
    "    name=names[i]['wenti'].replace('/','') + \".html\"\n",
    "\n",
    "    file = open(name, \"w\",encoding=\"utf-8\")\n",
    "    for item in detailDatasReverse:\n",
    "        if item['wentiId']==names[i]['_id']:\n",
    "            if 'beizhu' in item:\n",
    "                beizhu='<p style=\"color:gray;font-size:30px;\">'+item['beizhu']+'</p>'\n",
    "                file.write(beizhu)\n",
    "            if 'imageURL' in item:\n",
    "                imageURL='<img src=\"'+item['imageURL'].replace(url,'wx')+'\">'\n",
    "                file.write(imageURL)\n",
    "\n",
    "    file.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9a1e9efe",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
